﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.DTO;
using DXApplicationTangche.UC.项目流程.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.项目流程
{
    public partial class Form任务 : Form
    {
        public List<WBSItemsDTO> WBSItemsDTOs = new List<WBSItemsDTO>();
        public Form任务()
        {
            InitializeComponent();
            this.WindowState = FormWindowState.Maximized;
            //WBSItemsDTOs.Add(new WBSItemsDTO("01", "02", "测试", "cs", "李岩"));
            this.treeList任务.DataSource = this.WBSItemsDTOs;
        }
        //点击按钮添加父任务
        private void simpleButton添加任务_Click(object sender, EventArgs e)
        {
            //new Form添加任务(new FunctionHelper().Uuid,"").ShowDialog();
            String parentId;
            try {
                parentId = this.treeList任务.FocusedNode["parentId"].ToString();
            }
            catch {
                parentId = "";
            }


            new Form添加任务(
                WBSItemsDTOs.Count.ToString(),
                parentId
                ).ShowDialog();
        }
        //treelist点击添加子任务
        private void treeList任务_RowClick(object sender, DevExpress.XtraTreeList.RowClickEventArgs e)
        {
            Form添加任务 Form添加任务=    new Form添加任务(
                this.treeList任务.FocusedNode["id"].ToString(),
                this.treeList任务.FocusedNode["parentId"].ToString()
                );
            Form添加任务.Show();
            this.WBSItemsDTOs.Add(Form添加任务.WBSItemsDTO);
            this.treeList任务.DataSource = this.WBSItemsDTOs;
            this.treeList任务.Refresh();
            this.treeList任务.ExpandAll();
        }
    }
}
